<template>
  <el-container>
    <el-header>
      <h2>数据存储设置</h2>
    </el-header>
    <el-main>
      <el-form :model="form" label-width="150px">
        <el-form-item label="数据存储路径">
          <el-select v-model="form.storagePath" placeholder="请选择存储路径">
            <el-option label="本地" value="本地" />
            <el-option label="网络" value="网络" />
          </el-select>
        </el-form-item>

        <el-form-item label="数据分层规则">
          <el-select v-model="form.layeringRule" placeholder="请选择分层规则">
            <el-option label="区域" value="区域" />
            <el-option label="楼层" value="楼层" />
            <el-option label="分户" value="分户" />
          </el-select>
        </el-form-item>

        <el-form-item label="数据更新周期">
          <el-select v-model="form.updateInterval" placeholder="请选择更新周期">
            <el-option label="30秒" value="30秒" />
            <el-option label="1分钟" value="1分钟" />
            <el-option label="3分钟" value="3分钟" />
            <el-option label="5分钟" value="5分钟" />
            <el-option label="30分钟" value="30分钟" />
          </el-select>
        </el-form-item>

        <el-form-item label="坐标系">
          <el-select v-model="form.coordinateSystem" placeholder="请选择坐标系">
            <el-option label="WGS84" value="WGS84" />
            <el-option label="GCJ02" value="GCJ02" />
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="save">保存</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>

<script>
import { ref } from "vue";
import { ElMessage } from "element-plus";

export default {
  setup() {
    const form = ref({
      storagePath: "本地",
      layeringRule: "区域",
      updateInterval: "30秒",
      coordinateSystem: "WGS84"
    });

    const save = () => {
      ElMessage.success("保存成功！");
      console.log("保存的设置:", form.value);
      // 可在此添加保存逻辑，例如 API 请求
    };

    const cancel = () => {
      ElMessage.info("取消操作");
      // 可在此添加取消逻辑，例如重置表单
    };

    return { form, save, cancel };
  }
};
</script>

<style scoped>
.el-header {
  padding: 20px;
  text-align: center;
  background-color: #f5f7fa;
}
</style>
